#include <stdio.h>

void merge(int A[], int n, int b[], int m) {
    int a[n];
    for (int i=0;i<n;i++) a[i]=A[i];
    int p1=0,p2=0,i=0;
    while (p1<n || p2<m) {
        if (p1==n) A[i++]=b[p2++];
        else if (p2==m) A[i++]=a[p1++];
        else if (a[p1]<b[p2]) A[i++]=a[p1++];
        else A[i++]=b[p2++];
    }
}

